

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>字符串反向输出</title>
</head>

<body>
  <label for="inputStr">请输入字符串：</label>
  <input type="text" id="inputStr">
  <button onclick="reverseString()">反向输出</button>
  <p id="output"></p >
  <script>
    function reverseString() {
      var input = document.getElementById('inputStr').value;
      var reversed = input.split('').reverse().join('');
      document.getElementById('output').innerHTML = reversed;
    }
  </script>
</body>

</html>